(function(){

    let Factory = function() {
        if (this instanceof Factory) {
            return new this();
        }
        else {
            return new Factory();
        }
    }

    Factory.prototype.method = function() {
        console.log('this is a factory')
    };



}());